﻿@model NAccounting.Models.ProjectDetailsModel

@{
    ViewBag.Title = "Edit";
}

<script src="@Url.Content("~/Scripts/_date.js")"></script>
<script src="@Url.Content("~/Scripts/jquery.ganttView.js")"></script>
<script src="@Url.Content("~/Scripts/data.js")"></script>

<link rel='stylesheet' type='text/css' href='@Url.Content("~/Content/jquery.ganttView.css")' />

<script language="javascript">
    $(function () {
        var activitiesUrl = '@Url.Action("GetActivities", new { ProjectId = Model.Id })';
        var activityEditURL = '@Url.Action("Edit", "Activity")'
        var goToListUrl = '@Url.Action("Index")';

        var ganntCharName = "ganttChart";

        var goToListButtonName = "goToListButton";

        $("#" + ganntCharName).ganttView({
            dataUrl: activitiesUrl,
            slideWidth: 700,
            behavior: {
                onClick: function (data) {
                    window.location.href = activityEditURL + "/" + data.id;
                }
            }
        });

        $("#" + goToListButtonName).click(function () {
            window.location.href = goToListUrl;
        });
    });
</script>

<style>
    .ganttview-block
    {
        cursor:pointer;
    }
</style>

<div class="content-left">
    @Html.Partial("ContentLeftPartial")
</div>
<div class="content-right">
<h2>Edit</h2>
    <p>
        <button id="goToListButton" class="button-icon-return-icon-only">Voltar</button> | 
        <button id="saveButton" class="submit">Salvar</button>
    </p>
    <div>
        <h3>Detalhes</h3>
        <div class="edit-label">
            @Html.LabelFor(model => model.Name):
        </div>
        <div class="edit-field">
            @Html.TextBoxFor(model => model.Name, new { size = 50 })
        </div>
     </div>

    <div id="ganttContainer">
        <h3>Atividades</h3>
        @Html.ActionLink("Criar nova atividade", "Create", "Activity", new { ProjectId = Model.Id }, null)
		<div id="ganttChart" />
    </div>
    <p>&nbsp;</p>
</div>